package com.pai4j.remote.pgc.community;

import com.pai4j.common.bean.PAIPageResponseBeanUtil;
import com.pai4j.common.bean.PAIResponseBean;
import com.pai4j.domain.community.vo.request.CCExperienceReviewRequestVO;
import com.pai4j.domain.community.vo.request.CCExperienceSaveRequestVO;
import com.pai4j.domain.community.vo.response.cc.CTCExperienceDetailVO;
import com.pai4j.domain.community.vo.response.cc.CTCExperienceListVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Set;

/**
 * community Experience (经验) Feign Client
 * 提供社区经验相关的远程调用接口
 *
 * @author: CYM-pai
 * @date: 2025/10/28
 **/
@FeignClient(name = "pai4j-pgc-service", contextId = "ccExperienceClient")
public interface CCExperienceClient {

    /**
     * 保存/编辑经验
     */
    @PostMapping("/pgc-service/api/cc/experience/save")
    PAIResponseBean<Long> save(@RequestBody CCExperienceSaveRequestVO experienceSaveRequest);

    /**
     * 审核经验
     */
    @PostMapping("/pgc-service/api/cc/experience/review")
    PAIResponseBean<Boolean> review(@RequestBody CCExperienceReviewRequestVO experienceReviewRequest);

    /**
     * 更新经验为免费
     */
    @PostMapping("/pgc-service/api/cc/experience/updateFree/{id}")
    PAIResponseBean<Boolean> updateFree(@PathVariable("id") Long id);

    /**
     * 设置经验置顶
     */
    @PostMapping("/pgc-service/api/cc/experience/setTop/{id}/{status}")
    PAIResponseBean<Boolean> setTop(@PathVariable("id") Long id, 
                                    @PathVariable("status") Boolean status);

    /**
     * 设置经验推荐
     */
    @PostMapping("/pgc-service/api/cc/experience/setRecommend/{id}/{status}")
    PAIResponseBean<Boolean> setRecommend(@PathVariable("id") Long id, 
                                         @PathVariable("status") Boolean status);

    /**
     * 管理后台分页查询经验列表
     */
    @GetMapping("/pgc-service/api/cc/experience/adminPageList")
    PAIPageResponseBeanUtil<CTCExperienceDetailVO> adminPageList(
            @RequestParam(value = "kw", required = false) String kw,
            @RequestParam(value = "status", required = false) String status,
            @RequestParam(value = "pathId", required = false) Long pathId,
            @RequestParam(value = "pageNo", required = false, defaultValue = "1") Integer pageNo,
            @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize);

    /**
     * 分页查询最新经验列表
     */
    @GetMapping("/pgc-service/api/cc/experience/newPageList/{pathId}")
    PAIPageResponseBeanUtil<CTCExperienceListVO> newPageList(
            @PathVariable("pathId") Long pathId,
            @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
            @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize);

    /**
     * 分页查询推荐经验列表
     */
    @GetMapping("/pgc-service/api/cc/experience/recommendPageList/{pathId}")
    PAIPageResponseBeanUtil<CTCExperienceListVO> recommendPageList(
            @PathVariable("pathId") Long pathId,
            @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
            @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize);

    /**
     * 分页查询置顶经验列表
     */
    @GetMapping("/pgc-service/api/cc/experience/topPageList/{pathId}")
    PAIPageResponseBeanUtil<CTCExperienceListVO> topPageList(
            @PathVariable("pathId") Long pathId,
            @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
            @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize);

    /**
     * 获取经验详情
     */
    @GetMapping("/pgc-service/api/cc/experience/detail/{experienceId}")
    PAIResponseBean<CTCExperienceDetailVO> detail(
            @PathVariable("experienceId") Long experienceId,
            @RequestHeader(value = "client", required = false, defaultValue = "web") String client);

    /**
     * 删除经验
     */
    @GetMapping("/pgc-service/api/cc/experience/delete/{experienceId}")
    PAIResponseBean<Boolean> delete(@PathVariable("experienceId") Long experienceId);

    /**
     * 获取热门标签
     */
    @GetMapping("/pgc-service/api/cc/experience/hotSigns/{pathId}")
    PAIResponseBean<Set<String>> hotSigns(@PathVariable("pathId") Long pathId,
                                         @RequestParam(value = "size", defaultValue = "20") Integer size);

    /**
     * 获取推荐经验列表（首页）
     */
    @GetMapping("/pgc-service/api/cc/experience/recommendList/{pathId}")
    PAIResponseBean<List<CTCExperienceListVO>> recommendList(@PathVariable("pathId") Long pathId);
}

